
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Deepseek整合SpringAI - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Deepseek整合SpringAI - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">文档中描述的问答系统主要使用了哪四种核心技术或工具？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">该系统主要使用了Spring Boot（用于快速构建Java后端服务）、Deepseek（作为高性能的深度学习推理框架）、Spring AI（作为简化AI模型集成的工具包）以及Postman（用于测试和调用API接口）。</div>
          </div>
          <div class="card-source">来源: 1. 技术栈介绍</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">环境</div>
          <div class="card-question">在开始构建该问答系统项目之前，需要准备哪些必要的环境和软件？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">环境</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要准备四个主要部分：1. JDK 17或更高版本；2. Maven，用于构建和管理项目依赖；3. Postman，用于测试API接口；4. 一个已经训练好的Deepseek问答模型文件（例如qa_model.ds）。</div>
          </div>
          <div class="card-source">来源: 2. 环境准备</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">配置</div>
          <div class="card-question">为了让Spring AI能够正确加载和使用Deepseek模型，需要在`application.properties`文件中配置哪两个关键属性？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">配置</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要在`application.properties`中配置两个属性：`spring.ai.deepseek.model-path`用于指定模型文件的路径，以及`spring.ai.deepseek.device`用于指定推理设备（例如cpu）。</div>
          </div>
          <div class="card-source">来源: 4.2 配置 Spring AI</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">代码</div>
          <div class="card-question">在`QAService.java`中，是如何调用Deepseek模型来执行推理并获得答案的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">代码</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`QAService`类通过依赖注入的方式获得一个`DeepseekModel`的实例，然后在`answer`方法中调用`model.infer(question)`方法，将问题字符串传递给模型以获取推理结果。</div>
          </div>
          <div class="card-source">来源: 4.3 创建问答服务</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">API</div>
          <div class="card-question">用于提交问题的API端点的完整URL、HTTP请求方法和请求体（Body）格式是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">API</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">该API端点的HTTP方法是POST，URL为`http://localhost:8080/api/qa/ask`。请求体（Body）应选择`raw`类型，格式为`JSON`。</div>
          </div>
          <div class="card-source">来源: 6.1 创建 Postman 请求</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">代码</div>
          <div class="card-question">在项目代码中，`QAController.java`类的主要作用和职责是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">代码</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`QAController`是一个使用`@RestController`注解的控制器，其主要职责是定义API路由（`/api/qa`）。它包含一个使用`@PostMapping("/ask")`注解的方法，用于接收HTTP POST请求，从请求体中获取问题，并调用`QAService`来处理该问题。</div>
          </div>
          <div class="card-source">来源: 4.4 创建控制器</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">依赖管理</div>
          <div class="card-question">如何在Maven项目的`pom.xml`文件中添加对Deepseek库的支持？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">依赖管理</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要在`pom.xml`文件的`<dependencies>`部分添加一个`<dependency>`代码块，其中`groupId`为`ai.deepseek`，`artifactId`为`deepseek-java`，`version`为`1.0.0`。</div>
          </div>
          <div class="card-source">来源: 4.1 添加 Deepseek 依赖</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">项目结构</div>
          <div class="card-question">根据文档提供的项目结构，`QAController.java`和`QAService.java`这两个核心Java文件位于哪个目录下？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">项目结构</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">这两个文件都位于`src/main/java/com/ts/demo/`目录下。</div>
          </div>
          <div class="card-source">来源: 7. 项目结构</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">API</div>
          <div class="card-question">在使用Postman测试API时，发送一个请求来询问“什么是深度学习？”的JSON请求体应该如何编写？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">API</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">请求体应编写为以下JSON格式：`{ "question": "什么是深度学习？" }`。</div>
          </div>
          <div class="card-source">来源: 6.1 创建 Postman 请求</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
